# -*- encoding=utf8 -*-
__author__ = "Simon"

from airtest.core.api import *
from poco.drivers.android.uiautomation import AndroidUiautomationPoco
poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)

auto_setup(__file__)
xy = poco.get_screen_size()
x = xy[0]
y = xy[1]
touch([0.2*x,0.6*y])
#1.从右到左滑屏寻找pcr然后进入
for i in range(5):
    if exists(Template(r"tpl1596701917777.png", record_pos=(-0.341, -0.145), resolution=(1280, 720))):
        poco(text = "公主连结R").click()
        break
    else:
        swipe((0.9*x,0.5*y),(0.1*x,0.5*y),duration = 0.5)
        sleep(0.5)

#2.无需登录的进入游戏
wait(Template(r"tpl1596702713776.png", record_pos=(-0.426, 0.245), resolution=(1280, 720)))
sleep(1)
touch(Template(r"tpl1596702735506.png", record_pos=(-0.34, 0.246), resolution=(1280, 720)))
touch(Template(r"tpl1596780283515.png", record_pos=(0.45, -0.243), resolution=(1280, 720)))
wait(Template(r"tpl1596702775047.png", record_pos=(0.002, -0.236), resolution=(1280, 720)))
sleep(1)
touch(Template(r"tpl1596702789579.png", record_pos=(-0.003, 0.216), resolution=(1280, 720)))

#3.免费扭蛋
touch(Template(r"tpl1596703915944.png", record_pos=(0.279, 0.266), resolution=(1280, 720)))
wait(Template(r"tpl1596704058789.png", record_pos=(0.427, -0.204), resolution=(1280, 720)))
touch(Template(r"tpl1596704058789.png", record_pos=(0.427, -0.204), resolution=(1280, 720)))
if exists(Template(r"tpl1596704115875.png", record_pos=(0.248, 0.108), resolution=(1280, 720))):
    sleep(0.5)
    touch(Template(r"tpl1596704115875.png", record_pos=(0.248, 0.108), resolution=(1280, 720)))
    sleep(0.5)
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
    touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
    sleep(0.3)
    touch(Template(r"tpl1596704219457.png", record_pos=(-0.406, 0.266), resolution=(1280, 720)))
else:
    sleep(0.3)
    touch(Template(r"tpl1596704219457.png", record_pos=(-0.406, 0.266), resolution=(1280, 720)))

#4.探索
touch(Template(r"tpl1596704554276.png", record_pos=(0.0, 0.266), resolution=(1280, 720)))
wait(Template(r"tpl1596704600759.png", record_pos=(0.266, -0.099), resolution=(1280, 720)))
touch(Template(r"tpl1596704600759.png", record_pos=(0.266, -0.099), resolution=(1280, 720)))
wait(Template(r"tpl1596704641814.png", record_pos=(0.109, 0.066), resolution=(1280, 720)))
touch(Template(r"tpl1596704641814.png", record_pos=(0.109, 0.066), resolution=(1280, 720)))
if exists(Template(r"tpl1596705810387.png", record_pos=(0.208, 0.179), resolution=(1280, 720))):
        touch(Template(r"tpl1596704219457.png", record_pos=(-0.406, 0.266), resolution=(1280, 720)))
else:
    touch(Template(r"tpl1596704686863.png", record_pos=(0.234, -0.142), resolution=(1280, 720)))
    sleep(0.1)
    touch(Template(r"tpl1596704762800.png", record_pos=(0.414, 0.064), resolution=(1280, 720)))
    sleep(0.1)
    touch(Template(r"tpl1596704825306.png", record_pos=(0.263, 0.066), resolution=(1280, 720)))
    sleep(0.1)
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    wait(Template(r"tpl1596704896821.png", record_pos=(-0.003, 0.216), resolution=(1280, 720)))
    touch(Template(r"tpl1596704896821.png", record_pos=(-0.003, 0.216), resolution=(1280, 720)))
    wait(Template(r"tpl1596704947071.png", record_pos=(0.34, 0.066), resolution=(1280, 720)))
    touch(Template(r"tpl1596704947071.png", record_pos=(0.34, 0.066), resolution=(1280, 720)))
    sleep(0.1)
    touch(Template(r"tpl1596704995698.png", record_pos=(0.224, -0.142), resolution=(1280, 720)))
    sleep(0.1)
    touch(Template(r"tpl1596704762800.png", record_pos=(0.414, 0.064), resolution=(1280, 720)))
    sleep(0.1)
    touch(Template(r"tpl1596704825306.png", record_pos=(0.263, 0.066), resolution=(1280, 720)))
    sleep(0.1)
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    wait(Template(r"tpl1596704896821.png", record_pos=(-0.003, 0.216), resolution=(1280, 720)))
    touch(Template(r"tpl1596704896821.png", record_pos=(-0.003, 0.216), resolution=(1280, 720)))
    sleep(0.1)
    touch(Template(r"tpl1596704219457.png", record_pos=(-0.406, 0.266), resolution=(1280, 720)))
    
# #5.地下城
# touch(Template(r"tpl1596704554276.png", record_pos=(0.0, 0.266), resolution=(1280, 720)))
# sleep(0.1)
# touch(Template(r"tpl1596706202741.png", record_pos=(0.413, -0.099), resolution=(1280, 720)))
# if exists(Template(r"tpl1596706220989.png", record_pos=(0.437, 0.175), resolution=(1280, 720))):
#     touch(Template(r"tpl1596704219457.png", record_pos=(-0.406, 0.266), resolution=(1280, 720)))
# else:
#     touch(Template(r"tpl1596706274501.png", record_pos=(0.241, 0.084), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
#     wait(Template(r"tpl1596706333869.png", record_pos=(0.338, 0.167), resolution=(1280, 720)))
#     touch(Template(r"tpl1596706465291.png", record_pos=(0.148, 0.131), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706516917.png", record_pos=(0.375, 0.194), resolution=(1280, 720)))
#     touch(Template(r"tpl1596706735769.png", record_pos=(0.398, -0.188), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706762948.png", record_pos=(0.323, -0.099), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706801962.png", record_pos=(0.371, 0.189), resolution=(1280, 720)))
#     sleep(15)
#     wait(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     touch(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     sleep(3)
#     wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596707167154.png", record_pos=(-0.118, 0.027), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706516917.png", record_pos=(0.375, 0.194), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706801962.png", record_pos=(0.371, 0.189), resolution=(1280, 720)))
#     sleep(15)
#     wait(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     touch(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     sleep(3)
#     wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596707468907.png", record_pos=(0.156, 0.02), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706516917.png", record_pos=(0.375, 0.194), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706801962.png", record_pos=(0.371, 0.189), resolution=(1280, 720)))
#     sleep(15)
#     wait(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     touch(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     sleep(3)
#     wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596707509407.png", record_pos=(-0.151, -0.051), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706516917.png", record_pos=(0.375, 0.194), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706801962.png", record_pos=(0.371, 0.189), resolution=(1280, 720)))
#     sleep(15)
#     wait(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     touch(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     sleep(3)
#     wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596707527921.png", record_pos=(-0.401, -0.15), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706516917.png", record_pos=(0.375, 0.194), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706801962.png", record_pos=(0.371, 0.189), resolution=(1280, 720))
#     sleep(15)
#     wait(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     touch(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     sleep(3)
#     wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596707564572.png", record_pos=(0.049, 0.062), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706516917.png", record_pos=(0.375, 0.194), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706801962.png", record_pos=(0.371, 0.189), resolution=(1280, 720)))
#     sleep(15)
#     wait(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     touch(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     sleep(3)
#     wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596707598177.png", record_pos=(0.327, -0.045), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706516917.png", record_pos=(0.375, 0.194), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706801962.png", record_pos=(0.371, 0.189), resolution=(1280, 720)))
#     sleep(15)
#     wait(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     touch(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     sleep(3)
#     wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596707621354.png", record_pos=(-0.055, -0.163), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706516917.png", record_pos=(0.375, 0.194), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706801962.png", record_pos=(0.371, 0.189), resolution=(1280, 720)))
#     sleep(15)
#     wait(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     touch(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     sleep(3)
#     wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596707652211.png", record_pos=(-0.255, 0.023), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706516917.png", record_pos=(0.375, 0.194), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706801962.png", record_pos=(0.371, 0.189), resolution=(1280, 720)))
#     sleep(15)
#     wait(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     touch(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     sleep(3)
#     wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596707670211.png", record_pos=(0.213, -0.075), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706516917.png", record_pos=(0.375, 0.194), resolution=(1280, 720)))
#     sleep(0.1)
#     touch(Template(r"tpl1596706801962.png", record_pos=(0.371, 0.189), resolution=(1280, 720)))
#     sleep(45)
#     wait(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     touch(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
#     sleep(3)
#     wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
#     sleep(4)
#     wait(Template(r"tpl1596704219457.png", record_pos=(-0.406, 0.266), resolution=(1280, 720)))
#     touch(Template(r"tpl1596704219457.png", record_pos=(-0.406, 0.266), resolution=(1280, 720)))

#6.竞技场
touch(Template(r"tpl1596704554276.png", record_pos=(0.0, 0.266), resolution=(1280, 720)))
sleep(0.2)
touch(Template(r"tpl1596708905499.png", record_pos=(0.106, 0.168), resolution=(1280, 720)))
sleep(0.5)
if exists(Template(r"tpl1596709074425.png", record_pos=(-0.113, 0.104), resolution=(1280, 720))):
    touch(Template(r"tpl1596709074425.png", record_pos=(-0.113, 0.104), resolution=(1280, 720)))
else:
    sleep(0.1)
touch(Template(r"tpl1596709512284.png", record_pos=(0.051, -0.102), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596706801962.png", record_pos=(0.371, 0.189), resolution=(1280, 720)))
sleep(60)
wait(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
touch(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
sleep(1)
touch(Template(r"tpl1596704554276.png", record_pos=(0.0, 0.266), resolution=(1280, 720)))
sleep(0.2)
touch(Template(r"tpl1596709770538.png", record_pos=(0.361, 0.167), resolution=(1280, 720)))
sleep(0.5)
if exists(Template(r"tpl1596709074425.png", record_pos=(-0.113, 0.104), resolution=(1280, 720))):
    touch(Template(r"tpl1596709074425.png", record_pos=(-0.113, 0.104), resolution=(1280, 720)))
    sleep(0.2)
else:
    sleep(0.1)
touch(Template(r"tpl1596709512284.png", record_pos=(0.051, -0.102), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596709859782.png", record_pos=(0.372, 0.19), resolution=(1280, 720)))
touch(Template(r"tpl1596709879117.png", record_pos=(0.373, 0.19), resolution=(1280, 720)))
touch(Template(r"tpl1596706801962.png", record_pos=(0.371, 0.189), resolution=(1280, 720)))
sleep(200)
wait(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
touch(Template(r"tpl1596707093873.png", record_pos=(0.366, 0.243), resolution=(1280, 720)))
sleep(1)

#7.活动
#<----------------hard关卡---------------->
touch(Template(r"tpl1596704554276.png", record_pos=(0.0, 0.266), resolution=(1280, 720)))

touch(Template(r"tpl1596717269316.png", record_pos=(0.367, 0.171), resolution=(1280, 720)))
sleep(1)
if exists(Template(r"tpl1596702789579.png", record_pos=(-0.003, 0.216), resolution=(1280, 720))):
    touch(Template(r"tpl1596702789579.png", record_pos=(-0.003, 0.216), resolution=(1280, 720)))
    sleep(0.2)
else:
    sleep(0.1)

touch(Template(r"tpl1596710404473.png", record_pos=(0.423, -0.194), resolution=(1280, 720)))
sleep(0.3)
touch(Template(r"tpl1596716682285.png", record_pos=(-0.39, 0.031), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596704762800.png", record_pos=(0.414, 0.064), resolution=(1280, 720)),times=3)
sleep(0.1)
touch(Template(r"tpl1596704825306.png", record_pos=(0.263, 0.066), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
sleep(0.5)
wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
sleep(0.2)
if  exists(Template(r"tpl1596710635984.png", record_pos=(0.113, 0.104), resolution=(1280, 720))):
    touch(Template(r"tpl1596710635984.png", record_pos=(0.113, 0.104), resolution=(1280, 720)))
    sleep(0.3)
    touch((520,520))
    touch((745,520))
    touch(Template(r"tpl1596715810067.png", record_pos=(0.292, 0.174), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596715905283.png", record_pos=(0.053, 0.175), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596716043544.png", record_pos=(0.113, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596717269316.png", record_pos=(0.367, 0.171), resolution=(1280, 720)))
    touch(Template(r"tpl1596710404473.png", record_pos=(0.423, -0.194), resolution=(1280, 720)))
else:
    sleep(0.1)

touch(Template(r"tpl1596716668065.png", record_pos=(-0.234, -0.047), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596704762800.png", record_pos=(0.414, 0.064), resolution=(1280, 720)),times=3)
sleep(0.1)
touch(Template(r"tpl1596704825306.png", record_pos=(0.263, 0.066), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
sleep(0.5)
wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
sleep(0.2)
if  exists(Template(r"tpl1596710635984.png", record_pos=(0.113, 0.104), resolution=(1280, 720))):
    touch(Template(r"tpl1596710635984.png", record_pos=(0.113, 0.104), resolution=(1280, 720)))
    sleep(0.3)
    touch((520,520))
    touch((745,520))
    touch(Template(r"tpl1596715810067.png", record_pos=(0.292, 0.174), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596715905283.png", record_pos=(0.053, 0.175), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596716043544.png", record_pos=(0.113, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596717269316.png", record_pos=(0.367, 0.171), resolution=(1280, 720)))
    touch(Template(r"tpl1596710404473.png", record_pos=(0.423, -0.194), resolution=(1280, 720)))
else:
    sleep(0.1)

touch(Template(r"tpl1596716655087.png", record_pos=(-0.148, 0.117), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596704762800.png", record_pos=(0.414, 0.064), resolution=(1280, 720)),times=3)
sleep(0.1)
touch(Template(r"tpl1596704825306.png", record_pos=(0.263, 0.066), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
sleep(0.5)
wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
sleep(0.2)
if  exists(Template(r"tpl1596710635984.png", record_pos=(0.113, 0.104), resolution=(1280, 720))):
    touch(Template(r"tpl1596710635984.png", record_pos=(0.113, 0.104), resolution=(1280, 720)))
    sleep(0.3)
    touch((520,520))
    touch((745,520))
    touch(Template(r"tpl1596715810067.png", record_pos=(0.292, 0.174), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596715905283.png", record_pos=(0.053, 0.175), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596716043544.png", record_pos=(0.113, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596717269316.png", record_pos=(0.367, 0.171), resolution=(1280, 720)))
    touch(Template(r"tpl1596710404473.png", record_pos=(0.423, -0.194), resolution=(1280, 720)))
else:
    sleep(0.1)

touch(Template(r"tpl1596716637258.png", record_pos=(0.14, 0.109), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596704762800.png", record_pos=(0.414, 0.064), resolution=(1280, 720)),times=3)
sleep(0.1)
touch(Template(r"tpl1596704825306.png", record_pos=(0.263, 0.066), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
sleep(0.5)
wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
sleep(0.2)
if  exists(Template(r"tpl1596710635984.png", record_pos=(0.113, 0.104), resolution=(1280, 720))):
    touch(Template(r"tpl1596710635984.png", record_pos=(0.113, 0.104), resolution=(1280, 720)))
    sleep(0.3)
    touch((520,520))
    touch((745,520))
    touch(Template(r"tpl1596715810067.png", record_pos=(0.292, 0.174), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596715905283.png", record_pos=(0.053, 0.175), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596716043544.png", record_pos=(0.113, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596717269316.png", record_pos=(0.367, 0.171), resolution=(1280, 720)))
    touch(Template(r"tpl1596710404473.png", record_pos=(0.423, -0.194), resolution=(1280, 720)))
else:
    sleep(0.1)

touch(Template(r"tpl1596716609998.png", record_pos=(0.259, -0.016), resolution=(1280, 720)))

sleep(0.1)
touch(Template(r"tpl1596704762800.png", record_pos=(0.414, 0.064), resolution=(1280, 720)),times=3)
sleep(0.1)
touch(Template(r"tpl1596704825306.png", record_pos=(0.263, 0.066), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
sleep(0.5)
wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
sleep(0.2)
if  exists(Template(r"tpl1596710635984.png", record_pos=(0.113, 0.104), resolution=(1280, 720))):
    touch(Template(r"tpl1596710635984.png", record_pos=(0.113, 0.104), resolution=(1280, 720)))
    sleep(0.3)
    touch((520,520))
    touch((745,520))
    touch(Template(r"tpl1596715810067.png", record_pos=(0.292, 0.174), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596715905283.png", record_pos=(0.053, 0.175), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596716043544.png", record_pos=(0.113, 0.103), resolution=(1280, 720)))
    touch(Template(r"tpl1596717269316.png", record_pos=(0.367, 0.171), resolution=(1280, 720)))
    touch(Template(r"tpl1596710404473.png", record_pos=(0.423, -0.194), resolution=(1280, 720)))
else:
    sleep(0.1)
#<----------------normal1-5----------------->
touch(Template(r"tpl1596716439378.png", record_pos=(0.295, -0.194), resolution=(1280, 720)))
sleep(0.2)
touch(Template(r"tpl1596716524141.png", record_pos=(-0.001, 0.078), resolution=(1280, 720)))
touch(Template(r"tpl1596704762800.png", record_pos=(0.414, 0.064), resolution=(1280, 720)),duration=3)
touch(Template(r"tpl1596704825306.png", record_pos=(0.263, 0.066), resolution=(1280, 720)))
touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
sleep(0.2)
touch(Template(r"tpl1596716915632.png", record_pos=(-0.003, 0.216), resolution=(1280, 720)))
sleep(0.5)
wait(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
if  exists(Template(r"tpl1596710635984.png", record_pos=(0.113, 0.104), resolution=(1280, 720))):
    touch(Template(r"tpl1596710635984.png", record_pos=(0.113, 0.104), resolution=(1280, 720)))
    sleep(0.3)
    touch((520,195))
    touch((745,195))
    touch(Template(r"tpl1596715810067.png", record_pos=(0.292, 0.174), resolution=(1280, 720)))
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    sleep(0.2)
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    sleep(0.1)
    touch(Template(r"tpl1596715905283.png", record_pos=(0.053, 0.175), resolution=(1280, 720)))
    sleep(0.1)
    touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
    sleep(0.1)
    touch(Template(r"tpl1596716043544.png", record_pos=(0.113, 0.103), resolution=(1280, 720)))
    sleep(0.1)
    touch(Template(r"tpl1596717269316.png", record_pos=(0.367, 0.171), resolution=(1280, 720)))

else:
    sleep(0.1)
    
#8.商店购买药水
touch(Template(r"tpl1596720655321.png", record_pos=(0.141, 0.174), resolution=(1280, 720)))
sleep(0.2)
touch((520,195))
touch((745,195))
touch((970,195))
touch((1195,195))
touch(Template(r"tpl1596715810067.png", record_pos=(0.292, 0.174), resolution=(1280, 720)))
touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
sleep(0.3)
touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
touch(Template(r"tpl1596704219457.png", record_pos=(-0.406, 0.266), resolution=(1280, 720)))

#9.行会点赞
touch(Template(r"tpl1596720970457.png", record_pos=(0.219, 0.177), resolution=(1280, 720)))
if exists(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720))):
    sleep(0.1)
    touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
else:
    sleep(0.1)
touch(Template(r"tpl1596721044770.png", record_pos=(-0.252, 0.085), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596721080140.png", record_pos=(0.379, 0.046), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596704219457.png", record_pos=(-0.406, 0.266), resolution=(1280, 720)))

#10.任务收取
touch(Template(r"tpl1596721183759.png", record_pos=(0.37, 0.177), resolution=(1280, 720)))
sleep(0.2)
touch(Template(r"tpl1596721327790.png", record_pos=(0.379, 0.175), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596721254990.png", record_pos=(-0.004, 0.216), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596704219457.png", record_pos=(-0.406, 0.266), resolution=(1280, 720)))

#11.收取礼物
touch(Template(r"tpl1596721290877.png", record_pos=(0.448, 0.175), resolution=(1280, 720)))
sleep(0.1)
touch(Template(r"tpl1596721327790.png", record_pos=(0.342, 0.214), resolution=(1280, 720)))
touch(Template(r"tpl1596704447610.png", record_pos=(0.114, 0.103), resolution=(1280, 720)))
touch(Template(r"tpl1596704472118.png", record_pos=(0.0, 0.178), resolution=(1280, 720)))
touch(Template(r"tpl1596709074425.png", record_pos=(-0.113, 0.104), resolution=(1280, 720)))
touch(Template(r"tpl1596704219457.png", record_pos=(-0.406, 0.266), resolution=(1280, 720)))

#12.公会之家
touch(Template(r"tpl1596721627736.png", record_pos=(0.148, 0.261), resolution=(1280, 720)))
sleep(0.5)
touch(Template(r"tpl1596721652686.png", record_pos=(0.438, 0.162), resolution=(1280, 720)))

